import 'package:flutter/material.dart';
import 'package:flutter_syt/datas/feedback_item.dart';
import 'package:flutter_syt/generated/l10n.dart';
import 'package:flutter_syt/theme/theme_color.dart';
import 'package:flutter_syt/utils/global_date_time_format.dart';

class FeedbackListItem extends StatelessWidget {
  final FeedbackItem entity;

  const FeedbackListItem(this.entity);

  @override
  Widget build(BuildContext context) {
    List<String?> title = [
      entity.typeName,
      formatDate(entity.createTime),
    ];
    return Container(
      padding: EdgeInsets.symmetric(vertical: 15.0),
      decoration: BoxDecoration(
        border: Border(
          bottom: BorderSide(
            color: ThemeColor.dividerColor_grey,
            width: 0.5,
            style: BorderStyle.solid,
          ),
        ),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            formatDate(entity.createTime),
            // title.join('·'),
            style: TextStyle(
              color: Colors.black.withOpacity(0.4),
              fontSize: 14,
              fontWeight: FontWeight.w400,
            ),
          ),
          SizedBox(
            height: 10,
          ),
          Text(
            "${entity.content.text}${entity.content.images.map((e) => " [${S.of(context).feedback_image_desc}]").join()}",
            maxLines: 2,
            softWrap: false,
            overflow: TextOverflow.ellipsis,
            style: TextStyle(
              color: Colors.black.withOpacity(0.8),
              fontSize: 16,
              fontWeight: FontWeight.w500,
            ),
          ),
        ],
      ),
    );
  }
}
